public class moveZeroes {
    //移动零
    public void moveZeroes(int[] nums) {
        int dest = -1;
        int cur = 0;
        while(cur<nums.length){
            if(nums[cur]!=0){
                dest++;
                int tmp = nums[cur];
                nums[cur] = nums[dest];
                nums[dest] = tmp;
            }
            cur++;
        }

    }
    public void moveZeroes2(int[] nums) {
        for(int cur=0,dest=-1;cur<nums.length;cur++){
            if(nums[cur] != 0){
                dest++;
                int tmp = nums[cur];
                nums[cur] = nums[dest];
                nums[dest] = tmp;
            }
        }
    }


}
